<template>
  <div class="lix-abnor">
    <div class="lix-abnor__box">
      <img class="lix-abnor__image" v-if="image" :src="image" mode="widthFix" />
      <div class="lix-abnor__text" v-if="title">{{ title }}</div>
      <div class="lix-abnor__tip" v-if="tip">{{ tip }}</div>
      <div class="lix-abnor__btn" v-if="button" @click="emitAbnorTap">{{ button }}</div>
    </div>
  </div>
</template>

<script>
/* eslint-disable */
import Types from "./config";
export default {
  props: {
    type: {
      type: String,
      default: ""
    },
    tip: {
      type: String,
      default: ""
    }
  },
  data: {
    image: "",
    title: "",
    button: ""
  },
  created() {
    console.log("Now-type is : ", this.type);
    const type = this.type;
    if (type && Types[type]) {
      this.image = this.image || Types[type].image;
      this.title = this.title || Types[type].title;
      this.button = this.button || Types[type].button;
      this.tip = this.tip || Types[type].tip;
    }
  },
  methods: {
    emitAbnorTap(event) {
      let detail = event.detail;
      let option = {};
      this.$emit("abnortap", detail, option);
    }
  }
};
</script>

<style lang="scss">
@import "../../theme-chalk/mixins/mixins";
@import "../../theme-chalk/common/var";
@import "../../theme-chalk/_main.scss";

@include b(abnor) {
  position: relative;
  display: block;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  overflow: hidden;

  @include e(box) {
    position: absolute;
    display: flex;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  @include e(image) {
    width: 257px;
    background: transparent no-repeat;
    background-size: cover;
  }

  @include e(btn) {
    min-width: 114px;
    height: 33px;
    margin-top: 15px;
    padding: 0 15px;
    background-color: #ff5777;
    border: 0 none;
    border-radius: 1px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    line-height: 33px;
  }

  // @include e(btn:active) {
  //   background-color: #f5456e;
  // }

  @include e(text) {
    margin-top: 20px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
  }

  @include e(tip) {
    margin-top: 10px;
    color: #666;
    font-size: 12px;
  }
}
</style>
